import { ADD_PERSON } from '../constant'


const initState = [{ name: 'demo', age: 18, id: '001' }] //初始化状态
export default function personReducer(perstate = initState, action) {
    const { data, type } = action
    switch (type) {
        case ADD_PERSON: //若是添加一个人
            return [data, ...perstate]

        default:
            return perstate
    }
}